import {
  ACCESS_TOKEN_KAY,
  REFRESH_TOKEN_KAY,
  TOKEN_EXPIRES_KAY,
  USER_INFO_KAY
} from '@/enum/globalEnum'

export const clearAccessTokenLocalStorage = () => {
  uni.removeStorageSync(ACCESS_TOKEN_KAY)
}
export const setAccessTokenLocalStorage = (value: string) => {
  uni.setStorageSync(ACCESS_TOKEN_KAY, value)
}
export const clearRefreshTokenLocalStorage = () => {
  uni.removeStorageSync(REFRESH_TOKEN_KAY)
}
export const setRefreshTokenLocalStorage = (value: string) => {
  uni.setStorageSync(REFRESH_TOKEN_KAY, value)
}
export const clearTokenExpiresLocalStorage = () => {
  uni.removeStorageSync(TOKEN_EXPIRES_KAY)
}
export const setTokenExpiresLocalStorage = (value: string) => {
  uni.setStorageSync(TOKEN_EXPIRES_KAY, value)
}
export const clearUserInfoLocalStorage = () => {
  uni.removeStorageSync(USER_INFO_KAY)
}
export const setUserInfoLocalStorage = (value: string) => {
  uni.setStorageSync(USER_INFO_KAY, value)
}
export const getLocalStorage = (key) => {
  return uni.getStorageSync(key)
}
export const clearLocalStorage = () => {
  clearAccessTokenLocalStorage()
  clearRefreshTokenLocalStorage()
  clearTokenExpiresLocalStorage()
  clearUserInfoLocalStorage()
}
